/*
 *  This file is part of LifeBudget - Copyright 2010 Clifton Eaton
 *  ------------------------------------------------------------------
 *  LifeBudget is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  LifeBudget is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with LifeBudget.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.lifebudget.app.client.misc;

import com.google.gwt.i18n.client.NumberFormat;

/**
 * Convenience class wrapping a custom <code>NumberFormat</code> for displaying
 * number values.  Currently only supports a currency format.
 */
public class NumberFormatter {

	/** The Constant CURRENCY_PATTERN which represents the pattern $###,###,##0.00;-$###,###,##0.00. */
	private static final String CURRENCY_PATTERN = "$###,###,##0.00;-$###,###,##0.00";

	/** The Constant CURRENCY_NUMBER_FORMAT, holds the instance used by this helper class. */
	public static final NumberFormat CURRENCY_NUMBER_FORMAT = NumberFormat.getFormat(CURRENCY_PATTERN);

	/**
	 * Gets the currency formatted string.
	 * 
	 * @param amount
	 *            the amount
	 * @return the currency formatted string
	 */
	public static String getCurrencyFormattedString(double amount) {
		return NumberFormat.getFormat(CURRENCY_PATTERN).format(amount);
	}
}
